/**************************************************************
 *@ProjectName: blweibo
 *@FileName: Helper.java
 *@Date: 2011-5-30
 *@Copyright: 2011 www.hrbanlv.com Inc. All rights reserved.
 **************************************************************/
package com.zhiweibo.util;

import android.content.Context;

/**
 * The Class Helper.
 * 
 * @author SunHaibin
 * @since Android 1.6
 * @history 2011-5-30
 */
public class Helper {

    /**
     * Save string.
     * 
     * @param paramContext
     *            the param context
     * @param strName
     *            the str name
     * @param strValue
     *            the str value
     */
    public static void saveString(Context paramContext, String strName, String strValue) {
        paramContext.getSharedPreferences(Constant.FILE_NAME, 0).edit().putString(strName, strValue).commit();
    }

    /**
     * Gets the string.
     * 
     * @param context
     *            the context
     * @param strName
     *            the str name
     * @param strDefault
     *            the str default
     * @return the string
     */
    public static String getString(Context context, String strName, String strDefault) {
        return context.getSharedPreferences(Constant.FILE_NAME, 0).getString(strName, strDefault);
    }

    /**
     * Clear file.
     * 
     * @param context
     *            the context
     */
    public static void clearFile(Context context) {
        context.getSharedPreferences(Constant.FILE_NAME, 0).edit().clear().commit();
    }

    /**
     * Del string.
     * 
     * @param context
     *            the context
     * @param strName
     *            the str name
     * @return the boolean
     */
    public static Boolean delString(Context context, String strName) {
        return context.getSharedPreferences(Constant.FILE_NAME, 0).edit().remove(strName).commit();
    }

}
